#include "CPU_USE.h"

#if CPU_USE_EN

static uint16_t tic_count = 0;
static uint16_t count = 0;
static uint8_t tic_flg = 0;
static uint8_t cpu_use = 0;

void cpu_use_tic()
{
	tic_flg = 1;
	tic_count++;
	if (tic_count == 1000)
	{
		cpu_use = (1000 - count) / 10;
		tic_count = 0;
		count = 0;
	}
}

void cpu_use_handle()
{
	if (tic_flg)
	{
		tic_flg = 0;
		count++;
	}
}
uint8_t cpu_use_percent()
{
	return cpu_use;
}

#endif
